package basic

import (
	"fmt"
	"io/ioutil"
)

/*switch后面可以没有表达式*/
func mySwitch(scroe int) string {
	g := ""
	switch {
	case scroe < 60:
		g = "F"
	case scroe < 80:
		g = "B"
	case scroe <= 90:
		g = "A"
	default:
		panic(fmt.Sprintf(
			"Wrong scroe: %d", scroe))
	}
	return g
}

/*if语句*/
func myIf() {
	const filename = "a.txt"
	if file, err := ioutil.ReadFile(filename); err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("%s\n", file)
	}
}

func main() {
	//myIf()
	str := mySwitch(90)
	fmt.Println(str)
}
